Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Resolves misleading comments and patterns suggesting workspace IDs can be constructed from project/branch names. Makes it explicit that workspace IDs come from the backend and the old format is legacy-only.

Changes

1. Fixed Misleading Comments

  • config.ts: Updated generateLegacyId() (formerly generateWorkspaceId) to explicitly state it's ONLY for legacy support
  • debug/git-status.ts: Changed to use directory name only, with clear comment this isn't how production IDs work
  • App.stories.tsx: Updated mock IDs to use stable format (10 hex chars) instead of project-branch pattern
  • E2E tests: Added comments clarifying these test backward compatibility

2. Removed Legacy Support from Debug Commands

Debug commands are internal dev tools and don't need backward compatibility:

  • debug/list-workspaces.ts: Display actual workspace ID from config instead of generating legacy IDs
  • debug/agentSessionCli.ts: Require --workspace-id instead of deriving from project path

3. Renamed Method for Clarity

  • generateWorkspaceId()generateLegacyId() makes the legacy-only purpose explicit
  • Updated all call sites (config.ts, E2E tests, unit tests)

Why Keep the Function?

Stable IDs were introduced only 8 days ago (Oct 16). The function is necessary for:

  • Backward compatibility: Users with pre-Oct-16 workspaces need automatic migration
  • One-time migration: When users open cmux, old workspaces auto-migrate to config.json
  • E2E tests: Validates backward compatibility

Cost is minimal (80 LoC, 0.5% of config.ts) and breaking workspace access would be severe UX failure.

Testing

  • ✅ Type checking passes
  • ✅ Unit tests pass (config.test.ts)
  • ✅ No references to old generateWorkspaceId name remain

Generated with cmux

- Updated config.ts to clarify generateWorkspaceId is ONLY for legacy support
- Fixed debug/git-status.ts to not suggest project-branch ID format
- Updated App.stories.tsx mock IDs to use stable ID format (10 hex chars)
- Added clarifying comments to E2E test fixtures
- Documented that workspace IDs must come from backend, never constructed in frontend

The generateWorkspaceId method is kept for:
- Legacy workspace lookup (users may have old workspaces)
- E2E test backward compatibility
- Debug script legacy support
Debug commands are internal dev tools and don't need backward compatibility.

- debug/list-workspaces.ts: Display actual workspace ID from config instead of generating legacy IDs
- debug/agentSessionCli.ts: Require --workspace-id instead of deriving from project path

This eliminates any suggestion that workspace IDs can be constructed from project/branch names.
Makes the legacy-only purpose explicit in the method name.

- Renamed method in Config class
- Updated all call sites in config.ts (4 locations)
- Updated E2E test fixtures
- Updated config.test.ts

All tests pass.
@ammario ammario enabled auto-merge October 24, 2025 20:32
@ammario ammario added this pull request to the merge queue Oct 24, 2025
Merged via the queue into main with commit f64d2ea Oct 24, 2025
13 checks passed
@ammario ammario deleted the id-misconception branch October 24, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants